package com.ftg.learn.mapper;

import com.ftg.learn.pojo.Pingce;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface PingceMapper {
    //查找全部
    @Select("select * from pingce limit #{arg0},#{arg1}")
    public List<Pingce> showall(int begin,int end);
    //查一
    @Select("select * from pingce where pingce_id = ifnull(concat(#{pingce_id},%),pingce_id) or pingce_bt = ifnull(concat(#{pingce_bt},%),pingce_bt")
    public List<Pingce> findone(String pingce_id,String pingce_bt);
    //共多少条
    @Select("select count(*) from pingce")
    int getcount();
    //添加
    @Insert("insert into pingce(pingce_id,pingce_bt,pingce_nr,pingce_img)values(#{pingce_id},#{pingce_bt},#{pingce_nr},#{pingce_img})")
    public int add(Pingce pingce);
    //删除
    @Delete("delete from pingce where pingce_id = #{pingce_id}")
    public int delete(String pingce_id);
    @Update("update pingce set pingce_id = #{pingce_id},pingce_bt = #{pingce_bt},pingce_nr = #{pingce_nr},pingce_img = #{pingce_img}")
    public int update(Pingce pingce);
}
